//大家一起做游戏

#include <stdio.h>

int main()
{
	int people=0,number=0;
	int flag=0;
	int result=0;
	int j=1;
	int k=0;
	int round[100]={0};
	scanf("%d %d",&people,&number);
	for ( int i=1 ; i<=people ; i++ )
	{
		round[i]=i;
	}
	for ( j=1 ; j <=people-1 ; j++ )
	{
		for ( int k=1 ; k <= number ; k++ )
		{
			flag++;
			if ( flag > people )
			{
				flag = flag-people;
			}
			while ( round[flag] == 0 )	//跳过被排除在外的小朋友
			{
				flag++;
				if( flag > people )
				{
					flag = flag - people;
				}
			}
		}
		if ( flag > people )
		{
			flag = flag - people;
		}
		round[flag]=0;
	}
	
	for ( result=1 ; result<=people ; result++ )
	{
		if ( round[result] != 0 )
		{
			break;
		}
	}
	printf("The left child is NO %d.\n", result );
}